import request from '@/utils/http'
import {BaseResult} from '@/types/axios'

export class LoginService {
  // 通过手机号注册
  static register(params?: object) {
    return request.post<BaseResult>({
      url: '/user/auth/register_by_phone',
      data: params,
    })
  }

  // 通过手机号登录
  static login(params: object) {
    return request.post<BaseResult>({
      url: '/user/auth/login_by_phone',
      data: params,
    })
  }

  // 发送验证码
  static sendMsgCode(params: object) {
    return request.post<BaseResult>({
      url: '/user/auth/send_verify_code',
      data: params,
    })
  }

  // 刷新Token
  static refreshToken(params: object) {
    return request.get<BaseResult>({
      url: '/user/auth/refresh_token',
      params
    })
  }

  // 注销登录
  static logout() {
    return request.get<BaseResult>({
      url: '/user/auth/logout',
    })
  }
}